package com.yunji.order.consumer;

import com.yunji.base.provide.BaseDataBelongProvide;
import com.yunji.cabinet.domain.ContainerCell;
import com.yunji.cabinet.provide.CabinetProvide;
import com.yunji.coupon.bo.CouponAmtBO;
import com.yunji.coupon.bo.UseCouponBO;
import com.yunji.coupon.provide.CouponProvide;
import com.yunji.storage.bo.StorageRecordsListQueryBO;
import com.yunji.storage.bo.StorageTicketSelectQueryBO;
import com.yunji.storage.domain.StockDO;
import com.yunji.storage.domain.StorageRecordsDO;
import com.yunji.storage.domain.StorageTicketDO;
import com.yunji.storage.dto.StorageOperateDTO;
import com.yunji.storage.provide.StockProvide;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

/**
 * @author : peter-zhu
 * @date : 2024/10/26 16:54
 * @description : TODO
 **/
@Component
public class OrderConsumer {
    @Resource
    private CouponProvide couponProvide;

    @Resource
    private StockProvide stockProvide;

    @Resource
    private BaseDataBelongProvide belongProvide;

    @Resource
    private CabinetProvide cabinetProvide;

    public  void updateCabinetCell(Integer productNums, Integer ordinal, Long containerId, int i) {
        cabinetProvide.updateCabinetCell(productNums,ordinal,containerId,i);
    }

    public CouponAmtBO getCouponAmtById(Long couponId, BigDecimal orderSaleAmt) {
        return couponProvide.getCouponAmtById(couponId, orderSaleAmt);
    }

    public boolean userCoupon(UseCouponBO bo) {
        return couponProvide.useCoupon(bo);
    }

    public boolean backCoupon(Long orderId) {
        return couponProvide.backCoupon(orderId);
    }

    public void handleStock(List<StockDO> stock) {
        stockProvide.handleStock(stock);
    }

    public Integer selectStockStatus(Long belongId) {
        return belongProvide.selectStockStatus(belongId);
    }

    public void updateStockTicketStatus(StorageTicketDO ticket) {
        stockProvide.updateStockTicketStatus(ticket);
    }

    public void handleTissueCell(Long belongId, ContainerCell cell) {
        cabinetProvide.handleTissueCell(belongId,cell);
    }

//    public void setEventData(OrderDO order) {
//        cabinetProvide.setEventData(order);
//    }

    public void createStorageTicket(StorageTicketDO ticketDO) {
        stockProvide.createStorageTicket(ticketDO);
    }

    public void createStorageRecord(List<StorageRecordsDO> recordsList) {
        stockProvide.createStorageRecord(recordsList);
    }

    public StorageTicketDO selectStorageTicket(StorageTicketSelectQueryBO bo) {
        return stockProvide.selectStorageTicket(bo);
    }

    public List<StorageRecordsDO> getStorageRecords(StorageRecordsListQueryBO param){
        return stockProvide.getStorageRecords(param);
    }

    public void operateStorage(StorageOperateDTO operateDTO) {
        stockProvide.operateStorage(operateDTO);
    }
}
